package com.wind.trademark.common.interceptor;



import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

public class SessionTimeoutInterceptor extends HandlerInterceptorAdapter {

    
    public boolean preHandle(
            HttpServletRequest request,
            HttpServletResponse response,
            Object handler) throws Exception {
 //   	System.out.println(request.getRequestURL());
    	
//    	System.out.println(request.getHeader("x-requested-with"));

    	
//		if (request.getRequestURI().contains("user")
//				|| request.getRequestURI().contains("getDynamicMessages.gm")
//				|| request.getRequestURI().contains("common")
//				|| request.getRequestURI().contains("recallHumanService.gm")
//
//		){
//    		return true;
//    	}
//    	
//		if (SessionManager.getCurrentUser()==null) {
//			
//	    	if(request.getHeader("x-requested-with")!=null     
//	    		    && request.getHeader("x-requested-with").equalsIgnoreCase("XMLHttpRequest")){    
//    		    response.getWriter().write("{\"error\":true,\"errorCode\":\"SYS.TIMEOUT\",\"errorMsg\":\"sorry,your session is timeout. \"}");
//
//	    		} else{
//	    			response.sendRedirect("/web/pages/FTIndex.htm");
//
//	    		}
//			
//			return false;
//		} else {
//
//			return true;
//		}
    	return true;
    }
}